<?php
require_once dirname(__FILE__).'/include.php';
Master::loadCoreClass("DefaultControl");
$Default = new DefaultControl();
if(Get::getByKey('action')=='login')
{   
		$userName = Post::getByKey('username');
		$password = Post::getByKey('password');
		$password = md5($password);
		$res = $Default->selectSingle("admins",array('username'=>$userName,'password'=>$password ));
		if($res!=null)
		{
			Session::set('adminname',$res->username);
			Session::set('adminid',$res->id);
			Session::set('admingroup',$res->groupid);           
            //echo "<script>alert(\"提示:您已登录成功\");</script>"; 
            Header("Location:index.php");
		}else
			echo "<script>alert(\"提示:用户名或密码有错\");history.go(-1)</script>";  			
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=Config::$siteName ?></title>	
<?php
require_once dirname(__FILE__).'/_heard.php';
?>
</head>
	<body id="login">
		
		<div id="login-wrapper" class="png_bg">
			<div id="login-top">
			
				<h1>登录<?=$Project ?>统管理</h1>
				<!-- Logo (221px width) -->
				<img id="logo" src="Images/logo.png" alt="Simpla Admin logo" />
			</div> <!-- End #logn-top -->
			
			<div id="login-content">
				
				<FORM method="post" action="?action=login" name="adminlogin" id="adminlogin">
					
					<p>
						<label>用户名：</label>默认用户名：admin 密码：admin888
						<input class="text-input" type="text"  name="username" />
					</p>
					<div class="clear"></div>
					<p>
						<label>密码：</label>
						<input class="text-input" type="password"  name="password" />
					</p>
					
					<div class="clear"></div>
					<p>
						<input class="button" type="submit" value="Sign In" />
					</p>					
				</form>
			</div> 
			
		</div> 
		
  </body>
  </html>
